package bit2;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class bitMain2 {
    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        System.out.println("方法add");
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        list.add(6);
        list.add(7);
        list.add(8);
        System.out.println(list);
        System.out.println("=============");
        System.out.println("方法addAll(index,c)");
        List<Integer> list1=new LinkedList<>();
        list1.add(9);
        list1.add(10);
        list1.add(11);
        list1.add(12);
        list1.add(13);
        list1.add(14);
        list1.add(15);
        list1.add(16);
        list.addAll(2,list1);
        System.out.println(list);
        System.out.println("=============");
        System.out.println("方法contains");
        System.out.println(list.contains(6));
        System.out.println("=============");
        System.out.println("方法get");
        System.out.println(list.get(0));
        System.out.println("=============");
        System.out.println("方法indexof");
        System.out.println(list.indexOf(5));
        System.out.println("=============");
        System.out.println("方法remove");
        System.out.println("删除"+list.remove(5));
        System.out.println(list);
        System.out.println("=============");
        System.out.println("方法set");
        System.out.println("set"+list.set(0,5));
        System.out.println(list);
        System.out.println("=============");
        System.out.println("方法size");
        System.out.println(list.size());
        System.out.println("=============");
        System.out.println("方法isEmpty");
        System.out.println(list.isEmpty());
        System.out.println("=============");
        System.out.println("方法clear");
        list.clear();
    }
    public static void main1(String[] args) {
        List<Integer> list=new LinkedList<>();
        System.out.println("方法add");
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        list.add(6);
        list.add(7);
        list.add(8);
        System.out.println(list);
        System.out.println("=============");
        System.out.println("方法addAll(index,c)");
        List<Integer> list1=new LinkedList<>();
        list1.add(9);
        list1.add(10);
        list1.add(11);
        list1.add(12);
        list1.add(13);
        list1.add(14);
        list1.add(15);
        list1.add(16);
        list.addAll(2,list1);
        System.out.println(list);
        System.out.println("=============");
        System.out.println("方法contains");
        System.out.println(list.contains(6));
        System.out.println("=============");
        System.out.println("方法get");
        System.out.println(list.get(0));
        System.out.println("=============");
        System.out.println("方法indexof");
        System.out.println(list.indexOf(5));
        System.out.println("=============");
        System.out.println("方法remove");
        System.out.println("删除"+list.remove(5));
        System.out.println(list);
        System.out.println("=============");
        System.out.println("方法set");
        System.out.println("set"+list.set(0,5));
        System.out.println(list);
        System.out.println("=============");
        System.out.println("方法size");
        System.out.println(list.size());
        System.out.println("=============");
        System.out.println("方法clear");
        list.clear();
        System.out.println();
    }
}
